import request from '@/utils/request'

// 发布车辆
export function publishVehicleApi(id) {
  return request({
    url: `/publish/publishVehicle/${id}`,
    method: 'post'
  })
}

// 修改价格
export function modifyPriceApi(params) {
  return request({
    url: '/publish/modifyPrice',
    method: 'put',
    params
  })
}

// 下架车辆
export function offlineVehicleApi(id) {
  return request({
    url: `/publish/offlineVehicle/${id}`,
    method: 'put'
  })
}

// 重新发布车辆
export function rePublishVehicleApi(id) {
  return request({
    url: `/publish/rePublishVehicle/${id}`,
    method: 'put'
  })
}

// 获取首页今日上新数据
export function getNewListApi() {
  return request.get('publish/getNew')
}

// 获取车辆详情，渲染details页和修改车辆页
export function getVehicleDetailsApi(id) {
  return request.get(`/publish/details/${id}`)
}

// 获取分类页数据
export function getCategoryPageDataApi(id) {
  return request.get(`publish/getCategoryData/${id}`)
}

// 获取list页数据
export function listByConditionApi(data) {
  return request({
    url: 'publish/listByCondition',
    method: 'post',
    data
  })
}

// 创建订单页
export function getorderCarApi(vid) {
  return request.get(`/publish/orderCar/${vid}`)
}
